<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>全医科技后台管理系统</title>
    <meta name="keywords" content="">
    <meta name="description" content="。">
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta http-equiv="Access-Control-Allow-Origin" content="*">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="format-detection" content="telephone=no">
    <link rel="icon" href="images/favicon.ico">
    <link rel="stylesheet" href="lib/layui-v2.6.3/css/layui.css" media="all">
    <link rel="stylesheet" href="css/layuimini.css?v=2.0.4.2" media="all">
    <link rel="stylesheet" href="css/themes/default.css" media="all">
    <link rel="stylesheet" href="lib/font-awesome-4.7.0/css/font-awesome.min.css" media="all">
    <link rel="stylesheet" href="css/themes/login.css" media="all">
</head>
<body >
    <div class="main-body">
        <div class="login-main">
            <div class="login-top">
                <span>全医科技后台管理系统</span>
                <span class="bg1"></span>
                <span class="bg2"></span>
            </div>
            <div class="layui-form login-bottom layuimini-form" >
                <div class="center">
                    <div class="item">
                        <span class="icon icon-2"></span>
                        <input type="text" name="username" lay-verify="required"  placeholder="请输入登录账号" maxlength="24"/>
                    </div>
    
                    <div class="item">
                        <span class="icon icon-3"></span>
                        <input type="password" name="password" lay-verify="required"  placeholder="请输入密码" maxlength="20">
                        <span class="bind-password icon icon-4"></span>
                    </div>
    
                    <!-- <div id="validatePanel" class="item" style="width: 137px;">
                        <input type="text" name="captcha" placeholder="请输入验证码" maxlength="4">
                        <img id="refreshCaptcha" class="validateImg"  src="../images/captcha.jpg" >
                    </div> -->
    
                </div>
                <div class="tip">
                    <span class="icon-nocheck"></span>
                    <span class="login-tip">保持登录</span>
                    <!-- <a href="javascript:" class="forget-password">忘记密码？</a> -->
                </div>
                <div class="layui-form-item" style="text-align:center; width:100%;height:100%;margin:0px;">
                    <button class="login-btn" lay-submit="" lay-filter="login">立即登录</button>
                </div>
            </div>
        </div>
    </div>

<script src="lib/layui-v2.6.3/layui.js" charset="utf-8"></script>
<script src="js/lay-config.js?v=2.0.0" charset="utf-8"></script>
<script>
    
    layui.use(['form','jquery', 'layer', 'http'], function () {
        var $ = layui.jquery,
            layer = layui.layer,
            form = layui.form,
            http  = layui.http;
        
        $('.bind-password').on('click', function () {
            if ($(this).hasClass('icon-5')) {
                $(this).removeClass('icon-5');
                $("input[name='password']").attr('type', 'password');
            } else {
                $(this).addClass('icon-5');
                $("input[name='password']").attr('type', 'text');
            }
        });

        $('.icon-nocheck').on('click', function () {
            if ($(this).hasClass('icon-check')) {
                $(this).removeClass('icon-check');
            } else {
                $(this).addClass('icon-check');
            }
        });
        // 进行登录操作
        form.on('submit(login)', function (data) {
            data = data.field;
            console.error(data);
            if (data.username == '') {
                layer.msg('用户名不能为空');
                return false;
            }
            if (data.password == '') {
                layer.msg('密码不能为空');
                return false;
            }
            // if (data.captcha == '') {
            //     layer.msg('验证码不能为空');
            //     return false;
            // }
            $.post(
                http.api+'Register/adminlogin?t_='+http.ts,
                data,
                function(res){
                    console.error(res);
                    if(res.code === 200){
                        layer.msg(res.msg,{time:1000,icon:1},function(){
                            console.error("valuevaluevalue",res);
                            layui.data(http.token,{key:'admininfo',value: res.data.data});
                            layui.data(http.token,{key:'token',value: res.data.token});
                            window.location = 'index.html';
                        });
                    }else{
                        layer.msg(res.msg);
                    }
                });
            });
    });
</script>
</body>
</html>
